package _cn.com.jsr.translation.termidentifier;

import java.util.List;

import cn.com.jsr.translation.termidentifier.Dictionary;
import junit.framework.TestCase;

public class _Dictionary extends TestCase{
	public void testLoad(){
		String src = "term1 =  术语1\r\n"
				+ " log4j =  日志框架 \r\n"
				+ " slf4 VERSION 4  = 日志框架版本4  \r\n"
				+ " abc = ABC ";
		
		Dictionary dict = Dictionary.load(src);
		List<String> terms = dict.listTerms();
		
		assertTrue(terms.size() == 4);
		assertTrue(dict.has("term1"));
		assertEquals(dict.get("term1"), "术语1");
		assertTrue(dict.has("log4j"));
		assertEquals(dict.get("log4j"), "日志框架");
		assertTrue(dict.has("slf4 VERSION 4"));
		assertEquals(dict.get("slf4 VERSION 4"), "日志框架版本4");
		assertTrue(dict.has("abc"));
		assertEquals(dict.get("abc"), "ABC");
	}
}
